package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.domain.db.BlackList;
import com.tanhua.domain.db.UserInfo;
import com.tanhua.dubbo.mapper.BlackListMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class BlackListApiImpl implements BlackListApi {
    @Autowired
    private BlackListMapper blackListMapper;

    @Override
    public IPage<UserInfo> blackList(Long userId,Integer page,Integer pagesize) {
        IPage<UserInfo> iPage = new Page<>(page,pagesize);

        return blackListMapper.blcakList(iPage,userId);

    }

    @Override
    public void deleteBlackList(Integer blackUserId) {
        blackListMapper.delete(new LambdaQueryWrapper<BlackList>().eq(BlackList::getBlackUserId,blackUserId ));

    }
}
